// 专家库

import { CHECC_API_CMS } from '@/constants/proxy'
import request from '@/utils/request'
import { exportMethod } from '@/utils/utils'




//导出
const getExport=(data: any,fileName)=> {
  const params = {
    method:'post',
    url: CHECC_API_CMS + '/zjyrc/expert/export',
    data:data,
    fileName:fileName
  }
  return exportMethod(params)
}


// 数据字典

const getDictionary = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/dictItem/codelist`,
    data
  )
}

// 用户

const getUser= (data: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/user/getAll`,
    data
  )
}


// 获取用户单位

const getUnit = (data: any = {}) => {
  return request.get(
    CHECC_API_CMS + '/org/selectTreeByLoginOrg'
  )
}



// 详情

const getDetailById = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/zjyrc/expert/${id}`,
  )
}
// 变更

const getbgById = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/zjyrc/expert/alter/${id}`,
  )
}
// 详情

const getbgjltailByiId = (alterid: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/zjyrc/alterLog/list/${alterid}`,
  )
}


//新加/增加

const addForm = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/zjyrc/expert/add`,
    data
  )
}

//新加/编辑

const editForm = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/zjyrc/expert/update`,
    data
  )
}


// 查询列表


const getTable=(data: any)=> {
  return request({
    url:  CHECC_API_CMS + '/zjyrc/expert/list',
    method: 'post',
    data
  })
}


// 确定当前流程

const getConfirm = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/copyrights/confirm/${id}`,
  )
}

  // 流程中心--启动

  const  startProcess=(data: any)=>{
    return request({
      url: '/process-api/act/run/startProcess',
      method: 'post',
      data
    })

  }

  // 流程--通过
  const allowProcess=(data: any)=>{
    return request({
      url: '/process-api/act/task/completeTaskByVo',
      method: 'post',
      data
    })
  }

 // 流程--驳回
 const refuseProcess=(data: any)=>{
  return request({
    url: '/process-api/act/task/over',
    method: 'post',
    data
  })
}

//删除(批量)

 const getDelect = (ids: string[]) =>
  request({
    url: CHECC_API_CMS + `/zjyrc/expert/delete`,
    method: 'delete',
    data: ids,
  })
//上报
const getApplicant=(ids: string[])=> {
  request({
    method:'post',
    url: CHECC_API_CMS + '/zjyrc/expert/pushExpertInfo',
    data:ids
  })

}

export { addForm, allowProcess, editForm, getConfirm, getDelect,getApplicant, getDetailById, getDictionary, getExport, getTable, getUnit, getUser, refuseProcess, startProcess,getbgjltailByiId ,getbgById,}

